Gather Analysis

Mapped by core

library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyr)
library(dbplyr)
## 
## Attaching package: 'dbplyr'
## The following objects are masked from 'package:dplyr':
## 
##     ident, sql
gather_core_thin = read.csv("~/Downloads/hpc_ex1/thin/gather_core_thin.csv")

gather_core_plot = gather_core_thin %>% 
  pivot_longer(cols = c(basic_linear, binomial)) %>%
  ggplot(aes(x = cores, y = value, color = name)) +
  geom_vline(xintercept = c(12,24), linetype = "dashed", color = "black")+
  annotate("text", x = c(12,24), y = rep(0,2), label = c(12,24), 
           vjust = 1, hjust = -0.1,color="black")+
  geom_point(size = 1.5) +
  geom_line(aes(group = name), size = 0.6) + 
  labs(title = "Latency vs # Cores, Mapped by Core, Message Size 1 MPI_CHAR",
       x = "# Cores",
       y = "Latency (us)",
       color = "Allocation") +
  theme_bw() + 
  theme(legend.position = c(0.13, 0.82), 
        legend.background = element_rect(fill = "transparent", colour = NA))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
gather_core_plot

Mapped by socket

gather_socket_thin = read.csv("~/Downloads/hpc_ex1/thin/gather_socket_thin.csv")

gather_socket_plot = gather_socket_thin %>% 
  pivot_longer(cols = c(basic_linear, binomial)) %>%
  ggplot(aes(x = cores, y = value, color = name)) +
  geom_vline(xintercept = c(12,24), linetype = "dashed", color = "black")+
  annotate("text", x = c(12,24), y = rep(0,2), label = c(12,24), 
           vjust = 1, hjust = -0.1,color="black")+
  geom_point(size = 1.5) +
  geom_line(aes(group = name), size = 0.6) + 
  labs(title = "Latency vs # Cores, Mapped by Socket, Message Size 1 MPI_CHAR",
       x = "# Cores",
       y = "Latency (us)",
       color = "Allocation") +
  theme_bw() + 
  theme(legend.position = c(0.13, 0.82), 
        legend.background = element_rect(fill = "transparent", colour = NA))

gather_socket_plot

Mapped by node

gather_node_thin = read.csv("~/Downloads/hpc_ex1/thin/gather_node_thin.csv")

gather_node_plot = gather_node_thin %>% 
  pivot_longer(cols = c(basic_linear, binomial)) %>%
   ggplot(aes(x = cores, y = value, color = name)) +
  geom_vline(xintercept = c(12,24), linetype = "dashed", color = "black")+
  annotate("text", x = c(12,24), y = rep(0,2), label = c(12,24), 
           vjust = 1, hjust = -0.1,color="black")+
  geom_point(size = 1.5) +
  geom_line(aes(group = name), size = 0.6) + 
  labs(title = "Latency vs # Cores, Mapped by Node, Message Size 1 MPI_CHAR",
       x = "# Cores",
       y = "Latency (us)",
       color = "Allocation") +
  theme_bw() + 
  ylim(0, 2.1) +
  theme(legend.position = c(0.12, 0.86), 
        legend.background = element_rect(fill = "transparent", colour = NA))

gather_node_plot

Binomial Comparison

binomial = data.frame(core = gather_core_thin$binomial, socket = gather_socket_thin$binomial,                                 node = gather_node_thin$binomial, cores = gather_core_thin$cores)

binomial_plot = binomial %>% 
  pivot_longer(cols = c(core, socket, node)) %>%
  ggplot(aes(x = cores, y = value, color = name)) +
  geom_vline(xintercept = c(12,24), linetype = "dashed", color = "black")+
  annotate("text", x = c(12,24), y = rep(0,2), label = c(12,24), 
           vjust = 1, hjust = -0.1,color="black")+
  geom_point(size = 1.5) +
  geom_line(aes(group = name), size = 0.6) + 
  labs(title = "Binomial Tree Algorithm, Latency vs # Cores",
       x = "# Cores",
       y = "Latency (us)",
       color = "Allocation") +
  theme_bw() + 
  ylim(0, 2) +
  theme(legend.position = c(0.08, 0.84), 
        legend.background = element_rect(fill = "transparent", colour = NA))

binomial_plot

Gather Performance Model

library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
binomial_all = read.csv("~/Downloads/hpc_ex1/thin/gather_binomial.csv")

binomial_all = data.frame(
  log2Latency=as.numeric(unlist(log2(binomial_all %>% filter(Allocation == "node") %>% select(Latency)))),
  Processes= as.numeric(unlist(binomial_all %>% filter(Allocation == "node") %>% select(Processes))),
  log2MessageSize=as.numeric(unlist(log2(binomial_all %>% filter(Allocation == "node") %>% select(MessageSize))))
)

fig <- binomial_all %>%
  plot_ly(
    x = ~log2MessageSize,
    y = ~Processes,
    z = ~log2Latency,
    type = 'scatter3d',
    mode = 'markers',
    marker = list(
      size = 8, 
      color = ~log2Latency,
      line = list(color = 'black', width = 0.5)
    )
  ) %>%
  layout(
    scene = list(
      xaxis = list(
        title = "log2(MessageSize)",
        titlefont = list(size = 11)  
      ),
      yaxis = list(
        title = "Cores",
        titlefont = list(size = 11)  
      ),
      zaxis = list(
        title = "log2(Latency)",
        titlefont = list(size = 11)  
      )
    )
  )
fig
binomial_model = lm(log2Latency ~ -1 + log2MessageSize + Processes + I(log2MessageSize^2), data = binomial_all)
summary(binomial_model)
## 
## Call:
## lm(formula = log2Latency ~ -1 + log2MessageSize + Processes + 
##     I(log2MessageSize^2), data = binomial_all)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.85787 -0.22979  0.03264  0.36357  1.45789 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## log2MessageSize      -0.3175077  0.0084104  -37.75   <2e-16 ***
## Processes             0.0394438  0.0011324   34.83   <2e-16 ***
## I(log2MessageSize^2)  0.0402835  0.0004586   87.84   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5819 on 984 degrees of freedom
## Multiple R-squared:  0.9847, Adjusted R-squared:  0.9847 
## F-statistic: 2.114e+04 on 3 and 984 DF,  p-value: < 2.2e-16
fig <- binomial_all %>%
  plot_ly(
    x = ~log2MessageSize,
    y = ~Processes,
    z = ~log2Latency,
    type = 'scatter3d',
    mode = 'markers',
    marker = list(
      size = 6,  
      color = 'grey',
      opacity = 0.3,
      line = list(color = 'black', width = 0.5)
    )
  ) %>%
  layout(
    title = "",
    scene = list(
      xaxis = list(
        title = "log2(MessageSize)",
        titlefont = list(size = 11)  
      ),
      yaxis = list(
        title = "Cores",
        titlefont = list(size = 11)  
      ),
      zaxis = list(
        title = "log2(Latency)",
        titlefont = list(size = 11)  
      )
    )
  )

x_values <- seq(min(binomial_all$log2MessageSize), max(binomial_all$log2MessageSize), length.out = 100)
y_values <- seq(min(binomial_all$Processes), max(binomial_all$Processes), length.out = 100)
meshgrid <- expand.grid(log2MessageSize = x_values, Processes = y_values)

# Predict the z values using the linear model
z_values <- predict(binomial_model, newdata = meshgrid)

# Reshape the predicted z values into a matrix
z_matrix <- matrix(z_values, nrow = length(y_values), ncol = length(x_values), byrow = TRUE)

fig <- fig %>%
  add_surface(
    x = ~x_values,
    y = ~y_values,
    z = z_matrix, 
    opacity = 1,  
    colorscale = 'Plasma',
    name = 'Regression Plane',
    showlegend = FALSE,
    showscale = FALSE
  )

fig
## Warning: 'surface' objects don't have these attributes: 'mode', 'marker'
## Valid attributes include:
## '_deprecated', 'autocolorscale', 'cauto', 'cmax', 'cmid', 'cmin', 'coloraxis', 'colorbar', 'colorscale', 'connectgaps', 'contours', 'customdata', 'customdatasrc', 'hidesurface', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'legendgroup', 'legendgrouptitle', 'legendrank', 'lighting', 'lightposition', 'meta', 'metasrc', 'name', 'opacity', 'opacityscale', 'reversescale', 'scene', 'showlegend', 'showscale', 'stream', 'surfacecolor', 'surfacecolorsrc', 'text', 'textsrc', 'type', 'uid', 'uirevision', 'visible', 'x', 'xcalendar', 'xhoverformat', 'xsrc', 'y', 'ycalendar', 'yhoverformat', 'ysrc', 'z', 'zcalendar', 'zhoverformat', 'zsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'